#-------------------------------------------------------------------
# This file is part of the CMake build system for MPG
#     (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.MPG3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------

include(PreprocessorUtils)

macro(mpg_get_version HEADER)
  file(READ ${HEADER} TEMP_VAR_CONTENTS)
  
  get_preprocessor_entry(TEMP_VAR_CONTENTS MPG_VERSION_MAJOR MPG_VERSION_MAJOR)
  get_preprocessor_entry(TEMP_VAR_CONTENTS MPG_VERSION_MINOR MPG_VERSION_MINOR)
  get_preprocessor_entry(TEMP_VAR_CONTENTS MPG_VERSION_PATCH MPG_VERSION_PATCH)
  get_preprocessor_entry(TEMP_VAR_CONTENTS MPG_VERSION_NAME MPG_VERSION_NAME)
  get_preprocessor_entry(TEMP_VAR_CONTENTS MPG_VERSION_SUFFIX MPG_VERSION_SUFFIX)

  set(MPG_VERSION "${MPG_VERSION_MAJOR}.${MPG_VERSION_MINOR}.${MPG_VERSION_PATCH}")
endmacro()
